/**
 * Created by PengWei on 2018/7/24.
 */


namespace mengdao {
    import Event = egret.Event;
    import IDispose = mengdao.IDispose;

    export class ContextEvent extends Event {
        /**初始化*/
        public static INITIALIZE: string = "INITIALIZE";

        /**绑定了新的MAP*/
        public static BIND_MAP: string = "BIND_MAP";

        /** 在从绑定获取的时候创建了一个新的实例 */
        public static NEW_INSTANCE_IN_BIND:string = "NEW_INSTANCE_IN_BIND";

    }

    export class ContextEventBindData implements IDispose {
        public key: any;
        public value: any;
        public once: boolean;

        public constructor(key: any, value: any, once: boolean) {
            this.key = key;
            this.value = value;
            this.once = once;
        }

        public dispose(): void {
            this.key = null;
            this.value = null;
        }
    }

    export class BindEventData implements IDispose {
        public type: string;
        public callback: Function;
        public callbackObj: any;
        public appliedToContext: boolean = false;
        public once: boolean = false;

        public dispose() {
            this.callback = null;
            this.callbackObj = null;
        }
    }
}